Skip to content

Add and Revise Receiver Interface Comments#1710

Open
xstoicunicornx wants to merge 3 commits into
payjoin:masterfrom
xstoicunicornx:update-comments
Open

Add and Revise Receiver Interface Comments#1710
xstoicunicornx wants to merge 3 commits into
payjoin:masterfrom
xstoicunicornx:update-comments

Conversation

@xstoicunicornx

Copy link
Copy Markdown
Collaborator

Summary

This PR builds off of #1653 which added clear and consistent comments to the FFI receiver interface where they were missing before. This PR expands that work to revise the v1 and v2 comments to align closely with the patterns established in the FFI interface and add consistency to the doc strings between all the different typestates and interfaces. The goal of this PR was to make the documentation on how to use these receiver interfaces more clear and concise, and if deemed a strict improvement might be good to include in PDK v1.0 release.

Claude Opus 4.8 was used to collaboratively create and revise these doc strings.

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls

coveralls commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 29432697163

Coverage remained the same at 86.187%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15963
Covered Lines: 13758
Line Coverage: 86.19%
Coverage Strength: 345.57 hits per line

💛 - Coveralls

@caarloshenriq caarloshenriq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

/// the increased transaction size. If a sender specifies a receiver output for this purpose, this
/// function sets that parameter to None so that it is ignored in subsequent steps of the
/// receiver flow. This protects the receiver from accidentally subtracting fees from their own
/// outputs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph about additional_fee_contribution being cleared when it points at a receiver-owned output got dropped in the rewrite. That protection is still implemented, just moved to OriginalContext::new in common/mod.rs:35-40

Worth keeping this detail, it's not obvious from the new "ensure at least one output pays the receiver" wording, and it's a real guarantee callers should know about.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. What do you think?

Comment on lines -962 to -971
/// Validates whether the original PSBT contains outputs which pay to the receiver and only
/// then proceeds to the next typestate.
/// Identify which outputs in the original transaction belong to the receiver
/// and ensure at least one output pays the receiver.
///
/// Additionally, this function also protects the receiver from accidentally subtracting fees
/// from their own outputs: when a sender is sending a proposal,
/// they can select an output which they want the receiver to subtract fees from to account for
/// the increased transaction size. If a sender specifies a receiver output for this purpose, this
/// function sets that parameter to None so that it is ignored in subsequent steps of the
/// receiver flow. This protects the receiver from accidentally subtracting fees from their own
/// outputs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the note on v1/mod.rs, this paragraph about additional_fee_contribution sanitization was dropped here too

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also updated.

Rework the doc comments in the v2 receive module so the state-level
comments are concise and point to the method that advances to the next
typestate, while the per-method comments align with the wording added to
the FFI interface. Method docs now name their explicit transition return
type and describe the state each transition yields once successfully
persisted.
Apply the same doc comment rework to the v1 receive module: state-level
comments are concise and point to the method that advances to the next
typestate, while per-method comments align with the wording used in the
FFI interface. Unlike v2, v1 methods return the next state directly, so
the docs describe the returned state without transition or persistence
framing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants